package com.spddr.pmos.jpa;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import cn.seqdata.jpa.JpaNoGeneratedObject;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;

@Entity
@Table(name = "transmission_info")
public class Transmission extends JpaNoGeneratedObject {
	private static final long serialVersionUID = 1L;

	private Grid fromGrid;
	private Grid toGrid;

	public Transmission() {
		super();
	}

	public Transmission(Long id) {
		super(id);
	}

	public Transmission(Long id, String name) {
		super(id, name);
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "from_grid", nullable = false)
	@JsonSerialize(using = cn.seqdata.jackson.ObjectSerializer.IdName.class)
	public Grid getFromGrid() {
		return this.fromGrid;
	}

	public void setFromGrid(Grid fromGrid) {
		this.fromGrid = fromGrid;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "to_grid", nullable = false)
	@JsonSerialize(using = cn.seqdata.jackson.ObjectSerializer.IdName.class)
	public Grid getToGrid() {
		return this.toGrid;
	}

	public void setToGrid(Grid toGrid) {
		this.toGrid = toGrid;
	}
}